import { defineStore } from 'pinia';
import app from './app';
import customApi from "@/sheep/api/custom";

const goods = defineStore({
    id: 'goods',
    state: () => ({
        type:{}, // 商品状态
    }),
    getters: {},
    actions: {
        // 获取商品状态
        async getGoodsType() {
            const { data, code } = await customApi.goodsType();
            if (code === 1) {
                this.type = data;
            }
        }
    },
    persist: {
        enabled: true,
        strategies: [
            {
                key: 'goods-type-store',
            },
        ],
    },
});

export default goods;
